package at.main.gui;

import at.main.android.Graphics;
import at.main.util.ConfigPanel;
import at.main.util.ManagerFont;

public class SoundPage {
	public int iSelectMenu = 0;
	public static boolean isSound = false;
	public SoundPage() {
		iSelectMenu = 0;
		isSound = true;
	}

	public void paint(Graphics g) {
		g.setColor(0x87CEFF);
		g.fillRect(0, 0, MyCanvas.iWidth, MyCanvas.iHeight);
		if (ConfigPanel.iTypeScreen == 1) {
			ManagerFont.drawString(g, "Bạn có muốn mở âm thanh không ?",
					MyCanvas.iWidth / 2, MyCanvas.iHeight / 3, 2, 2);
			ManagerFont.drawString(g, "Bật",
					MyCanvas.iWidth / 2, MyCanvas.iHeight / 3+ 20, 2, ((0-iSelectMenu)==0?1:2));
			ManagerFont.drawString(g, "Tắt",
					MyCanvas.iWidth / 2, MyCanvas.iHeight / 3+ 40, 2, ((1-iSelectMenu)==0?1:2));
		} else {
			ManagerFont.drawString(g, "Bạn có muốn mở", MyCanvas.iWidth /2,
					MyCanvas.iHeight / 4, 2, 2);
			ManagerFont.drawString(g, "âm thanh không ?", MyCanvas.iWidth / 2,
					MyCanvas.iHeight / 4 + 20, 2, 2);
			ManagerFont.drawString(g, "Bật", MyCanvas.iWidth/ 2,
					MyCanvas.iHeight / 4 + 40, 2, ((0-iSelectMenu)==0?1:2));
			ManagerFont.drawString(g, "Tắt", MyCanvas.iWidth/ 2,
					MyCanvas.iHeight / 4 + 60, 2, ((1-iSelectMenu)==0?1:2));
		}
	}

	public void update() {
		// Up
		if (MyCanvas.keyHold[2]) {
			iSelectMenu--;
			if(iSelectMenu < 0)
				iSelectMenu = 1;
		}
		if (MyCanvas.keyHold[8]) {
			iSelectMenu++;
			if(iSelectMenu > 1)
				iSelectMenu = 0;
		}
		if(MyCanvas.keyHold[5]){
			//System.out.println("iSelectMenu  "+ iSelectMenu);
			if(iSelectMenu == 0)
				isSound = true;
			else
				isSound = false;
			MyCanvas.iCurrentPage = MyCanvas.k_SplashPage;
			MyCanvas.clearInput();			
		}
		MyCanvas.clearInput();
	}
}
